#include <iostream>
#include <cstdio>
using namespace std;

int main() {
	int T, a, b;
	cin>>T;
	while(T--) {
		cin>>a>>b;
		if (a<b) swap(a,b);
		cout<<a+a+b<<endl;
	}
	return 0;
} 
